<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" isELIgnored="false"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"     uri="http://java.sun.com/jstl/fmt_rt" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>
<script type="text/javascript">
<!--
//-->
</script>
<style>
#sa_table {text-align:center;border:1px solid #ddd; border-width:0 0 1px 1px;}

#sa_table th {background:#CCEEFF;}
#sa_table th,#sa_table td {height:22px; border:1px solid #ddd; border-width:1px 1px 0 0;}
</style>

	<div style="background-color:#F5F5F5;margin-top:0.1cm;">
	<s:form action="SaMgr_search" validate="false">
		<fmt:setLocale value="en_US"/> 
		<input id="offset" type="hidden"  value="${pm.offset}">
		<div align="left">
			<s:actionmessage cssStyle="color:#0000FF;"/>
			<s:actionerror cssStyle="color:#F00;"/>
		</div>
		
		<c:if test="${searchUnRead != true}">
				<table width="90%" height="60" >
					<tr align="left">
						<td align="right" width="15%" class="label_bold">
						   <s:text name="sa.saNo"/>:
						</td>
						<td align="left"  width="15%">
							<s:textfield name="saNo" size="15"/>
						</td>
						<td align="right" width="10%" class="label_bold">
					   		<s:text name="SA Type"/>:
						</td>
						<td align="left"  width="10%">
							<s:select id="saType" name="saType" list="saTypeList"/>
						</td>
						<td align="right"  width="15%" class="label_bold">
							<s:text name="sa.isPendding"/>:
						</td>
						<td align="left" width="15%">
							<s:select name="isPendding" list="penddingStatus"/>
						</td>
						<td align="left" width="30%">
							<s:submit key="action.search" action="SaMgr_search" cssClass="btn"/>
						</td>
					</tr>
				</table>
		</c:if>
	</s:form>
	
	<div align="left">
		<table width="100%" id="sa_table">
			<thead>
				<tr class="ui-widget-header">
				<th style="width: 10%">SA Number</th>
				<th style="width: 15%">Shipper</th>
				<th style="width: 10%">Order No</th>
				<th style="width: 10%">MAWB/BL NO</th>
				<th style="width: 5%">Piece</th>
				<th style="width: 10%">Weight</th>
				<th style="width: 10%">Volume</th>
				<th style="width: 5%">Status</th>
			</tr>
		</thead>
		<tbody>
			<s:include value="./component/result_empty.jsp"></s:include>
			<c:forEach var="eachSa" items="${pm.datas}">
				<tr>
					<td>
						<a href="SaMgr_editSa.do?editSaId=${eachSa.id}">${eachSa.saNo}</a>
						 <c:if test="${eachSa.saType == 'air'}">A</c:if>
					    <c:if test="${eachSa.saType == 'ocean'}">O</c:if>
					</td>
					<td>${eachSa.hawbShipper}</td>
					<td>${eachSa.orderNo}</td>
					<td>
						<c:if test="${eachSa.saType== 'air'}">
							${eachSa.mawbNo}
						</c:if>
						<c:if test="${eachSa.saType== 'ocean'}">
							${eachSa.blNo}
						</c:if>
					</td>
					<td><fmt:formatNumber pattern="###" value="${eachSa.pcb}"></fmt:formatNumber></td>
					<td>${eachSa.weight}</td>
					<td>${eachSa.estimatedDimensions}</td>
					<td>${eachSa.stateShow}</td>
				</tr>
			</c:forEach>
			</tbody>
		</table>
	</div>
</div>

<div align="left">
  		<pg:pager url="${searchUrl}" items="${pm.total}" maxPageItems="${pm.maxPageItems}" export="currentPageNumber=pageNumber">  
		<pg:param name="saNo"/>
		<pg:param name="saType"/>
		<pg:param name="userId"/>
		<pg:page export="firstItem, lastItem">
			<div class="resultInfo">
				Displaying results <strong><%= firstItem %>-<%= lastItem %></strong> of <strong>${pm.total}</strong> found
			</div>
		</pg:page>
		
		<div class="rnav">
			<span class="rnavLabel">Results:</span>&nbsp;
			<pg:prev export="pageUrl">
				<a href="<%= pageUrl %>" class="rnavLink">&#171;&nbsp;Prev</a>&nbsp;
			</pg:prev>
			<pg:pages export="pageUrl,pageNumber,firstItem,lastItem">
			    <% if (pageNumber == currentPageNumber) { %> 
			&nbsp;<span class="rnavCurr"><%= firstItem %>-<%= lastItem %></span>
			    <% } else { %>
			&nbsp;<a href="<%= pageUrl %>" class="rnavLink"><%= firstItem %>-<%= lastItem %></a>
			    <% } %>
			</pg:pages>
			<pg:next export="pageUrl">
				&nbsp;&nbsp;<a href="<%= pageUrl %>" class="rnavLink">Next&nbsp;&#187;</a>
			</pg:next>
		</div>
  	 </pg:pager>
</div>